Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow enabling usage logs on GCS storage buckets & enable for LEAP #3407

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

yuvipanda
Copy link
Member

In https://2i2c.freshdesk.com/a/tickets/1105, we were requested to turn on usage
logs
for the GCP buckets in the LEAP project. This moves that config into terraform, but also makes it clearer that while we can enable this config, we currently can not actually help folks parse the logs. But the data format is simple enough that they should be able to.

@yuvipanda yuvipanda requested a review from a team as a code owner November 13, 2023 07:47
Copy link
Contributor

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make the title reflect that this PR adds new gcp specific terraform config as well?

This LGTM, added some trivial code suggestions.

Comment on lines +109 to +110
Note that we currently can not actually help hub admins process these
logs - that is *their* responsibility. We can only *enable* this logging.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clarifying responsibility as done here as part of introducing this feature is super important - nice!!!

@yuvipanda yuvipanda changed the title LEAP: Enable usage logs for GCP buckets Allow enabling usage logs on GCS storage buckets & enable for LEAP Nov 13, 2023
yuvipanda and others added 2 commits November 13, 2023 14:07
In https://2i2c.freshdesk.com/a/tickets/1105, we were
requested to turn on [usage
logs](https://cloud.google.com/storage/docs/access-logs)
for the GCP buckets in the LEAP project. This moves that
config into terraform, but also makes it clearer that while
we can enable this config, we currently can not actually help
folks *parse* the logs. But the data format is simple
enough that they should be able to.
Co-authored-by: Erik Sundell <[email protected]>
Co-authored-by: Erik Sundell <[email protected]>
@yuvipanda
Copy link
Member Author

Applied and looks good

Copy link
Contributor

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wiee nice!

@yuvipanda yuvipanda merged commit 034e919 into 2i2c-org:master Nov 13, 2023
yuvipanda added a commit to yuvipanda/pilot-hubs that referenced this pull request Nov 13, 2023
- lifecycle condition should be int
- Fix typo in naming usage log bucket

Missed pushing this commit as a part of
2i2c-org#3407
@yuvipanda yuvipanda mentioned this pull request Nov 13, 2023
@consideRatio
Copy link
Contributor

consideRatio commented Nov 13, 2023

@2i2c-org/engineering this could make you see new resources be created like below when doing terraform apply for some other reason, but this is expected and fine.

Terraform will perform the following actions:

  # google_storage_bucket.usage_logs_bucket will be created
  + resource "google_storage_bucket" "usage_logs_bucket" {
      + force_destroy               = false
      + id                          = (known after apply)
      + labels                      = (known after apply)
      + location                    = "EUROPE-WEST1"
      + name                        = "qcl-gcs-usage-logs"
      + project                     = "qcl-hub"
      + public_access_prevention    = (known after apply)
      + self_link                   = (known after apply)
      + storage_class               = "STANDARD"
      + uniform_bucket_level_access = (known after apply)
      + url                         = (known after apply)

      + lifecycle_rule {
          + action {
              + type = "Delete"
            }
          + condition {
              + age                   = 30
              + matches_prefix        = []
              + matches_storage_class = []
              + matches_suffix        = []
              + with_state            = (known after apply)
            }
        }
    }

  # google_storage_bucket_iam_member.usage_logs_bucket_access will be created
  + resource "google_storage_bucket_iam_member" "usage_logs_bucket_access" {
      + bucket = "qcl-gcs-usage-logs"
      + etag   = (known after apply)
      + id     = (known after apply)
      + member = "group:[email protected]"
      + role   = "roles/storage.objectCreator"
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + usage_log_bucket                    = "qcl-gcs-usage-logs"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done 🎉
Development

Successfully merging this pull request may close these issues.

2 participants